﻿using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.Xna.Framework.Input;

namespace XNAGuiLib
{
    public class MouseHandler
    {

        #region Static Method - CheckCurrentOnePressedOldAllReleased(MouseState ms, MouseState oms)
        public static bool CheckCurrentOnePressedOldAllReleased(MouseState ms, MouseState oms)
        {
            // checks if all buttons of the old state are released and only one of the current is pressed
            if ((oms.LeftButton == ButtonState.Released 
                    && oms.MiddleButton == ButtonState.Released 
                    && oms.RightButton == ButtonState.Released
                    && oms.XButton1 == ButtonState.Released
                    && oms.XButton2 == ButtonState.Released)
                   && (ms.LeftButton == ButtonState.Pressed 
                        || ms.MiddleButton == ButtonState.Pressed 
                        || ms.RightButton == ButtonState.Pressed
                        || ms.XButton1 == ButtonState.Pressed
                        || ms.XButton2 == ButtonState.Pressed))
            {
                return true;
            }
            else return false;
        }
        #endregion

        #region Static Method - CheckCurrentAllReleasedOldOneReleased(MouseState ms, MouseState oms)
        public static bool CheckCurrentAllReleasedOldOneReleased(MouseState ms, MouseState oms)
        {
            if ((oms.LeftButton == ButtonState.Released 
                    && oms.MiddleButton == ButtonState.Released 
                    && oms.RightButton == ButtonState.Released
                    && oms.XButton1 == ButtonState.Released
                    && oms.XButton2 == ButtonState.Released)
                    && (ms.LeftButton == ButtonState.Released 
                        || ms.MiddleButton == ButtonState.Released 
                        || ms.RightButton == ButtonState.Released
                        || ms.XButton1 == ButtonState.Released
                        || ms.XButton2 == ButtonState.Released))
            {
                return true;
            }
            else return false;
        }
        #endregion

    }
}